// myscript.js
// This example uses Node 8's async/await syntax.
/* eslint-disable */

const oracledb = require('oracledb');

oracledb.outFormat = oracledb.OUT_FORMAT_OBJECT;

// const mypw = ...  // set mypw to the hr schema password

async function run() {

  let connection;

  try {
    oracledb.initOracleClient({libDir: 'C:\\ProgramFiles\\instantclient-basic-windows.x64-12.2.0.1.0\\instantclient_12_2'});
    
    connection = await oracledb.getConnection( {
      user          : "szkitm",
      password      : 'kingsware',
      connectString : "192.168.0.201:1521/vcenter"
    });


    const result = await connection.execute(
      `SELECT * FROM CBHB_YWTJ cy `
    );
    // const result = await connection.execute(
    //   `SELECT manager_id, department_id, department_name
    //    FROM departments
    //    WHERE manager_id = :id`,
    //   [103],  // bind value for :id
    // );
    console.log(result.rows);

  } catch (err) {
    console.error(err);
  } finally {
    if (connection) {
      try {
        await connection.close();
      } catch (err) {
        console.error(err);
      }
    }
  }
}

run();